package com.bbkb.common.exception;

/**
 * 自定义异常基类
 */
public class BaseException extends Exception {

    private static final long serialVersionUID = 7804957016110991687L;
    /**
     * 默认的异常信息内容
     */
    public static final String DEFAULT_ERR_CODE = "999";
    /**
     * 默认的异常信息内容
     */
    public static final String DEFAULT_ERR_MSG = "系统好像出错了，小巴正在努力抢修中";

    /**
     * 错误代码
     */
    protected String errorCode;
    /**
     * 错误详情
     */
    protected String detail;

    public BaseException() {
        this.errorCode = DEFAULT_ERR_CODE;
        this.detail = DEFAULT_ERR_MSG;
    }

    public BaseException(String detail) {
        this.detail = detail;
    }

    public BaseException(String errorCode, String detail) {
        this.errorCode = errorCode;
        this.detail = detail;
    }

    public String getDetail() {
        return detail;
    }

    public String getErrorCode() {
        return errorCode;
    }

    @Override
    public String toString() {
        return "BaseException{" +
                "errorCode='" + errorCode + '\'' +
                ", detail='" + detail + '\'' +
                '}';
    }
}
